#include "kran-08-scheinwerfer.h"

// Polygons for object 'licht' (18 polygons)

	void
licht()
{
	static const GLfloat VertexData[] = {
		1.57540f, 2.62257f, 0.873476f, 0.492647f, 2.62257f, 0.873476f, -0.492647f, 2.62257f, 0.873476f, 
		-1.57437f, 2.62257f, 0.873476f, 1.57540f, 1.18202f, 0.873476f, 
		0.492647f, 1.18202f, 0.873476f, -0.492647f, 1.18202f, 0.873476f, 
		-1.57437f, 1.18202f, 0.873476f, 1.57540f, -0.188122f, 0.873476f, 
		0.492648f, -0.188122f, 0.873476f, -0.492647f, -0.188122f, 0.873476f, 
		-1.57437f, -0.188123f, 0.873476f, 1.57540f, -1.62761f, 0.873476f, 
		0.492648f, -1.62761f, 0.873476f, -0.492647f, -1.62761f, 0.873476f, 
		-1.57437f, -1.62761f, 0.873476f
	};
	static const GLfloat NormalData[] = {
		0.000000f, 0.000000f, 1.00000f, 0.000000f, 0.000000f, 1.00000f, 0.000000f, 0.000000f, 1.00000f, 
		0.000000f, 0.000000f, 1.00000f, 1.91582e-014f, -1.74010e-007f, 1.00000f, 
		5.50493e-008f, -4.35024e-008f, 1.00000f, 0.000000f, 0.000000f, 1.00000f, 
		0.000000f, 0.000000f, 1.00000f, 2.20197e-007f, -1.69818e-007f, 1.00000f, 
		2.20197e-007f, -1.65627e-007f, 1.00000f, 9.12629e-015f, -1.65627e-007f, 1.00000f, 
		3.65052e-014f, -1.65627e-007f, 1.00000f, 0.000000f, 0.000000f, 1.00000f, 
		1.10099e-007f, -2.48441e-007f, 1.00000f, 0.000000f, -3.31255e-007f, 1.00000f, 
		3.65052e-014f, -3.31255e-007f, 1.00000f
	};
	static const GLfloat TexCoordData[] = {
		0.125679f, 0.987840f, 0.372266f, 0.987840f, 0.618853f, 0.987840f, 
		0.865440f, 0.987840f, 0.125679f, 0.662008f, 
		0.372266f, 0.662008f, 0.618853f, 0.662008f, 
		0.865440f, 0.662008f, 0.125679f, 0.336177f, 
		0.372266f, 0.336177f, 0.618853f, 0.336177f, 
		0.865440f, 0.336177f, 0.125679f, 0.0103461f, 
		0.372266f, 0.0103461f, 0.618853f, 0.0103461f, 
		0.865440f, 0.0103461f
	};
	static const GLint Indices[] = {
		5, 4, 0, 1, 5, 0, 2, 6, 5, 1, 2, 5, 7, 6, 2, 3, 
		7, 2, 5, 9, 8, 4, 5, 8, 10, 9, 5, 6, 10, 5, 7, 11, 
		10, 6, 7, 10, 13, 12, 8, 9, 13, 8, 10, 14, 13, 9, 10, 13, 
		15, 14, 10, 11, 15, 10
	};

	glEnableClientState(GL_TEXTURE_COORD_ARRAY);
	glTexCoordPointer(2, GL_FLOAT, 0, TexCoordData);
	glEnableClientState(GL_NORMAL_ARRAY);
	glNormalPointer(GL_FLOAT, 0, NormalData);
	glEnableClientState(GL_VERTEX_ARRAY);
	glVertexPointer(3, GL_FLOAT, 0, VertexData);

	OGL_Set_Current_Material_Parameters(32.0000f, 1.00000f, 1.00000f, 1.00000f, 1.00000f, 1.00000f, 1.00000f);

	if(lightOnOff == 0) {
		// Set a new diffuse texture map
		OGL_Set_Current_Texture_Map(kran_scheinwerfer_64, 1.00000f, 1.00000f, 0.000000f, 0.000000f);
	}
	else OGL_Set_Current_Texture_Map(kran_scheinwerferHell_64, 1.00000f, 1.00000f, 0.000000f, 0.000000f);

	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[0]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[3]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[6]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[9]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[12]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[15]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[18]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[21]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[24]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[27]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[30]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[33]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[36]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[39]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[42]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[45]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[48]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[51]);
}	// End of polygons for object 'licht'

// Polygons for object 'scheinwerfer' (46 polygons)

	void
scheinwerfer()
{
	static const GLfloat VertexData[] = {
		-0.251961f, 1.18789f, -0.955365f, -0.251961f, 1.18789f, -0.955365f, -0.251961f, 1.18789f, -0.955365f, 
		-0.251961f, 1.26646f, -0.551165f, -0.251961f, 1.26646f, -0.551165f, 
		-0.251961f, 1.26646f, -0.551165f, 0.251961f, 1.18789f, -0.955365f, 
		0.251961f, 1.18789f, -0.955365f, 0.251961f, 1.18789f, -0.955365f, 
		0.251961f, 1.26646f, -0.551165f, 0.251961f, 1.26646f, -0.551165f, 
		0.251961f, 1.26646f, -0.551165f, 0.251961f, -2.62313f, -0.214577f, 
		0.251961f, -2.62313f, -0.214577f, 0.251961f, -2.62313f, -0.214577f, 
		0.251961f, -2.54457f, 0.189622f, 0.251961f, -2.54457f, 0.189622f, 
		0.251961f, -2.54457f, 0.189622f, -0.251961f, -2.62313f, -0.214577f, 
		-0.251961f, -2.62313f, -0.214577f, -0.251961f, -2.62313f, -0.214577f, 
		-0.251961f, -2.54457f, 0.189622f, -0.251961f, -2.54457f, 0.189622f, 
		-0.251961f, -2.54457f, 0.189622f, 1.57500f, -1.62687f, 0.778893f, 
		1.57500f, -0.776866f, 0.0877165f, 1.57500f, -0.776866f, 0.0877165f, 
		1.57500f, 0.0731337f, -0.279930f, 1.57500f, 0.0731337f, -0.279930f, 
		1.57500f, 0.923134f, -0.279929f, 1.57500f, 0.923134f, -0.279929f, 
		1.57500f, 1.77313f, 0.0877169f, 1.57500f, 1.77313f, 0.0877169f, 
		1.57500f, 2.62313f, 0.778894f, 1.57500f, 2.62313f, 0.778894f, 
		1.57500f, -1.62687f, 0.955364f, 1.57500f, -1.62687f, 0.955364f, 
		1.57500f, -0.776866f, 0.955364f, 1.57500f, 0.0731335f, 0.955364f, 
		1.57500f, 0.923134f, 0.955364f, 1.57500f, 1.77313f, 0.955364f, 
		1.57500f, 2.62313f, 0.955364f, 1.57500f, 2.62313f, 0.955364f, 
		-1.57500f, -1.62687f, 0.778894f, -1.57500f, -0.776866f, 0.0877171f, 
		-1.57500f, -0.776866f, 0.0877171f, -1.57500f, 0.0731337f, -0.279929f, 
		-1.57500f, 0.0731337f, -0.279929f, -1.57500f, 0.923134f, -0.279929f, 
		-1.57500f, 0.923134f, -0.279929f, -1.57500f, 1.77313f, 0.0877175f, 
		-1.57500f, 1.77313f, 0.0877175f, -1.57500f, 2.62313f, 0.778894f, 
		-1.57500f, 2.62313f, 0.778894f, -1.57500f, -1.62687f, 0.955364f, 
		-1.57500f, -1.62687f, 0.955364f, -1.57500f, -0.776866f, 0.955364f, 
		-1.57500f, 0.0731335f, 0.955364f, -1.57500f, 0.923134f, 0.955365f, 
		-1.57500f, 1.77313f, 0.955365f, -1.57500f, 2.62313f, 0.955365f, 
		-1.57500f, 2.62313f, 0.955365f
	};
	static const GLfloat NormalData[] = {
		0.000000f, -0.190809f, -0.981627f, -1.00000f, 2.50995e-008f, 2.90048e-007f, 0.000000f, 0.981627f, -0.190808f, 
		0.000000f, 0.190809f, 0.981627f, -1.00000f, 2.50994e-008f, 2.90048e-007f, 
		0.000000f, 0.981627f, -0.190808f, 0.000000f, -0.190809f, -0.981627f, 
		1.00000f, -2.50995e-008f, -2.90048e-007f, 0.000000f, 0.981627f, -0.190808f, 
		1.16108e-007f, 0.190809f, 0.981627f, 1.00000f, -2.50995e-008f, -2.90048e-007f, 
		0.000000f, 0.981627f, -0.190808f, 0.000000f, -0.190809f, -0.981627f, 
		0.000000f, -0.981628f, 0.190807f, 1.00000f, -2.50995e-008f, -2.90048e-007f, 
		2.32217e-007f, 0.190809f, 0.981627f, 2.25690e-008f, -0.981628f, 0.190807f, 
		1.00000f, -2.50995e-008f, -2.90049e-007f, 0.000000f, -0.190809f, -0.981627f, 
		-1.00000f, 2.50996e-008f, 2.90048e-007f, 2.25690e-008f, -0.981628f, 0.190807f, 
		1.16108e-007f, 0.190809f, 0.981627f, -1.00000f, 2.50995e-008f, 2.90048e-007f, 
		4.51379e-008f, -0.981628f, 0.190807f, 0.589164f, -0.666283f, -0.457113f, 
		0.557923f, -0.397481f, -0.728513f, 0.557923f, -0.397481f, -0.728513f, 
		0.805312f, -0.0799236f, -0.587440f, 0.805312f, -0.0799236f, -0.587440f, 
		0.561849f, 0.223044f, -0.796604f, 0.561849f, 0.223044f, -0.796604f, 
		0.802407f, 0.332753f, -0.495398f, 0.802407f, 0.332753f, -0.495398f, 
		0.342522f, 0.901141f, -0.265752f, 0.342522f, 0.901141f, -0.265752f, 
		0.447214f, -0.894427f, 0.000000f, 0.447214f, -0.894427f, 0.000000f, 
		1.00000f, 0.000000f, 0.000000f, 1.00000f, 0.000000f, 0.000000f, 
		1.00000f, 0.000000f, 0.000000f, 1.00000f, 0.000000f, 0.000000f, 
		0.894427f, 0.447214f, 0.000000f, 0.894427f, 0.447214f, 0.000000f, 
		-0.589164f, -0.775015f, -0.228557f, -0.557923f, -0.462734f, -0.688912f, 
		-0.557923f, -0.462734f, -0.688912f, -0.805312f, -0.159847f, -0.570896f, 
		-0.805312f, -0.159847f, -0.570896f, -0.561849f, 0.111522f, -0.819688f, 
		-0.561849f, 0.111522f, -0.819688f, -0.802407f, 0.285830f, -0.523875f, 
		-0.802407f, 0.285830f, -0.523875f, -0.342522f, 0.774714f, -0.531504f, 
		-0.342522f, 0.774714f, -0.531504f, -0.707107f, -0.707107f, 0.000000f, 
		-0.707107f, -0.707107f, 0.000000f, -1.00000f, 0.000000f, 0.000000f, 
		-1.00000f, 0.000000f, 0.000000f, -1.00000f, 0.000000f, 0.000000f, 
		-1.00000f, 0.000000f, 0.000000f, -0.707107f, 0.707107f, 0.000000f, 
		-0.707107f, 0.707107f, 0.000000f
	};
	static const GLfloat TexCoordData[] = {
		0.000000f, -0.000000f, 1.00000f, 1.00000f, 0.000000f, 1.00000f, 
		0.000000f, 1.00000f, 1.00000f, -0.000000f, 
		0.000000f, -0.000000f, 1.00000f, -0.000000f, 
		0.000000f, 1.00000f, 1.00000f, 1.00000f, 
		1.00000f, 1.00000f, 0.000000f, -0.000000f, 
		1.00000f, -0.000000f, 1.00000f, 1.00000f, 
		0.000000f, 1.00000f, 1.00000f, 1.00000f, 
		1.00000f, -0.000000f, 0.000000f, -0.000000f, 
		1.00000f, -0.000000f, 0.000000f, 1.00000f, 
		0.000000f, 1.00000f, 1.00000f, 1.00000f, 
		0.000000f, -0.000000f, 0.000000f, -0.000000f, 
		1.00000f, -0.000000f, 0.000000f, 1.00000f, 
		0.000000f, 1.00000f, 0.200000f, 1.00000f, 
		0.000000f, 1.00000f, 0.400000f, 1.00000f, 
		0.000000f, 1.00000f, 0.600000f, 1.00000f, 
		0.000000f, 1.00000f, 0.800000f, 1.00000f, 
		0.000000f, 1.00000f, 1.00000f, 1.00000f, 
		0.000000f, 1.00000f, 0.000000f, -0.000000f, 
		0.200000f, -0.000000f, 0.400000f, -0.000000f, 
		0.600000f, -0.000000f, 0.800000f, -0.000000f, 
		0.000000f, 1.00000f, 1.00000f, -0.000000f, 
		0.000000f, 1.00000f, 0.000000f, 1.00000f, 
		0.200000f, 1.00000f, 0.000000f, 1.00000f, 
		0.400000f, 1.00000f, 0.000000f, 1.00000f, 
		0.600000f, 1.00000f, 0.000000f, 1.00000f, 
		0.800000f, 1.00000f, 0.000000f, 1.00000f, 
		1.00000f, 1.00000f, 0.000000f, 1.00000f, 
		0.000000f, -0.000000f, 0.200000f, -0.000000f, 
		0.400000f, -0.000000f, 0.600000f, -0.000000f, 
		0.800000f, -0.000000f, 0.000000f, 1.00000f, 
		1.00000f, -0.000000f
	};
	static const GLint Indices[] = {
		2, 5, 8, 5, 11, 8, 7, 10, 14, 10, 17, 14, 13, 16, 20, 16, 
		23, 20, 19, 22, 1, 22, 4, 1, 18, 0, 12, 0, 6, 12, 3, 21, 
		9, 21, 15, 9, 37, 36, 24, 26, 37, 24, 28, 38, 37, 26, 28, 37, 
		39, 38, 28, 30, 39, 28, 32, 40, 39, 30, 32, 39, 42, 40, 32, 34, 
		42, 32, 43, 55, 56, 43, 56, 45, 56, 57, 47, 56, 47, 45, 47, 57, 
		58, 47, 58, 49, 58, 59, 51, 58, 51, 49, 51, 59, 61, 51, 61, 53, 
		35, 54, 43, 43, 24, 35, 44, 25, 24, 24, 43, 44, 46, 27, 25, 25, 
		44, 46, 48, 29, 27, 27, 46, 48, 50, 31, 29, 29, 48, 50, 52, 33, 
		31, 31, 50, 52, 33, 52, 60, 60, 41, 33
	};

	glEnableClientState(GL_TEXTURE_COORD_ARRAY);
	glTexCoordPointer(2, GL_FLOAT, 0, TexCoordData);
	glEnableClientState(GL_NORMAL_ARRAY);
	glNormalPointer(GL_FLOAT, 0, NormalData);
	glEnableClientState(GL_VERTEX_ARRAY);
	glVertexPointer(3, GL_FLOAT, 0, VertexData);


	OGL_Set_Current_Material_Parameters(32.0000f, 1.00000f, 1.00000f, 1.00000f, 1.00000f, 1.00000f, 1.00000f);

	// Set a new diffuse texture map
	OGL_Set_Current_Texture_Map(kran_schwarz, 1.00000f, 1.00000f, 0.000000f, 0.000000f);

	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[0]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[3]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[6]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[9]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[12]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[15]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[18]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[21]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[24]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[27]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[30]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[33]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[36]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[39]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[42]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[45]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[48]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[51]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[54]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[57]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[60]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[63]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[66]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[69]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[72]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[75]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[78]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[81]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[84]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[87]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[90]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[93]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[96]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[99]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[102]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[105]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[108]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[111]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[114]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[117]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[120]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[123]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[126]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[129]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[132]);
	glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[135]);
}	// End of polygons for object 'scheinwerfer'

void zeichneScheinwerfer() {
	if(lightOnOff == 1) glMaterialfv(GL_FRONT, GL_EMISSION, mat_emissionAn);
	licht();
	glMaterialfv(GL_FRONT, GL_EMISSION, mat_emissionAus);
	scheinwerfer();
}
